<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    var o = {
        arr:[]
    }
    Object.defineProperty(o,'username',{
        get:function(){
            console.log('aaa')
            return this.arr;
        },
        set:function(v){
            this.arr.push(v)
            console.log("bb")
        }
    })
//    o.username = 'frank';
//    o.foo();
//    for(var i in o){
//        console.log(i);
//    }

//    console.log(o.username);
    o.username = 'frank';
    o.username = 'tom';
    o.username = 'jack';
        console.log(o.username);

</script>
</body>
</html>